package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppAdapter;
import com.jjb.www.http.api.HomeMessageListApi;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2018/11/05
 *    desc   : 可进行拷贝的副本
 */
public final class MessageListAdapter extends AppAdapter<HomeMessageListApi.Bean> {

    public MessageListAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private ShapeTextView mTvName;
        private ShapeTextView mTvTime;


        private ViewHolder() {
            super(R.layout.item_message_list);
            mTvName = findViewById(R.id.tv_name);
            mTvTime = findViewById(R.id.tv_time);
        }

        @Override
        public void onBindView(int position) {
            mTvName.setText(getItem(position).getTitle());
            mTvTime.setText(getItem(position).getCreate_time());
        }
    }
}